package cn.iocoder.yudao.module.member.dal.mysql.userrefund;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.userrefund.UserRefundDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.userrefund.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 退款 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserRefundMapper extends BaseMapperX<UserRefundDO> {

    default PageResult<UserRefundDO> selectPage(UserRefundPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserRefundDO>()
                .eqIfPresent(UserRefundDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserRefundDO::getRefund, reqVO.getRefund())
                .eqIfPresent(UserRefundDO::getAliAccount, reqVO.getAliAccount())
                .eqIfPresent(UserRefundDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(UserRefundDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserRefundDO::getId));
    }

    Integer totalRefund(@Param("userId") Long userId);

}